﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DirectorySlicer
{
    /// <summary>
    /// a bin for encapsulating a bunch of files and counts the number and size of the containing ones
    /// </summary>
    class Bin : IComparable
    {
        private List<FileContainer> files = new List<FileContainer>();
        private long currSize = (long)(1.45 * 1024 * 1024); //overhead of disk for burning
        private int count = 0;

        public void addFile(FileContainer file){
            files.Add(file);
            currSize += file.getSize();
            count++;
        }

        public List<FileContainer> getFiles()
        {
            return files;
        }

        public long getSize()
        {
            return currSize;
        }

        public int getCount()
        {
            return count;
        }
        int IComparable.CompareTo(Object obj)
        {
            if (obj == this)
                return 0;
            Bin k = (Bin)obj;
            if (this.getSize() > k.getSize()) return -1;
            if (k.getSize() > this.getSize()) return 1;
            return 0;
        }
    }
}
